package com.ocom.common.enums.emqx;

/**
 * 洗衣机物联网设备状态枚举
 */
public enum DeviceStatusEnum {

    Using(1,"使用中") ,
    Err(2,"故障") ,
    Soak(3,"浸泡") ,
    Wash(4,"洗涤") ,
    Potch(5,"漂洗") ,
    Dehydration(6,"脱水") ,
    LeftUsing(31,"左路在使用") ,
    RightUsing(32,"右路在使用") ,
    TwoUsing(33,"两路都在使用") ,

    FREE(0,"空闲");

    private final Integer key;
    private final String msg;

    DeviceStatusEnum(Integer key, String msg) {
        this.key = key;
        this.msg = msg;
    }

    /**
     * 根据key获取value
     *
     * @param key : 键值key
     * @return String
     */
    public static String getValueByKey(Integer key) {
        DeviceStatusEnum[] enums = DeviceStatusEnum.values();
        for (int i = 0; i < enums.length; i++) {
            if (enums[i].getKey().equals(key)) {
                return enums[i].getMsg();
            }
        }
        return "";
    }

    public Integer getKey() {
        return key;
    }

    public String getMsg() {
        return msg;
    }


}
